<?php
session_start();
if(isset($_SESSION['admin_id'])) {
    include "../../include/dbFunctions.php";
    $file = "../../upload/cv/".$_GET['file'];
    if (unlink($file)) {
        $_SESSION['mes']='File has been removed sucessfully';
    }
    $vid=$_SESSION['vid'];
    $query="UPDATE volunteer
            SET volunteer_cv = ''
            WHERE volunteer_id = $vid";
    $result = executeQuery($query);
    if ($result!=0) {
        $_SESSION['mes'].="The record has been updated successfully";
        header('Location: ' . $_SERVER['HTTP_REFERER']);
    } else {
        $_SESSION['mes'].="Error! Please try again";
        header('Location: ' . $_SERVER['HTTP_REFERER']);
    }
    ?>
    <?php
}else {
    header("Location: ../include/login.html");
}
?>